home *** CD-ROM | disk | FTP | other *** search
- #
- # cancel a message (only the poster can cancel a message)
- #
- # Copyright (C) 1994 Afzal Ballim
-
- ############################################################
- #
- # WFCommandCancel:
- #
- sub WFCommandCancel {
- local (%in)=@_;
-
- $user=$ENV{"REMOTE_USER"};
- %userdb=&WFReadDBFile($user);
-
- if ($in{"forum"} eq "") {return "No forum given";}
- if ($in{"subject"} eq "") {return "No subject given";}
- if ($in{"message"} eq "") {return "No message selected";}
-
- %mb=&WFGetFile("ABSWFSPOOL/$in{forum}/$in{subject}/$in{message}");
-
- # have tobe the creator or a webmaster to cancel
- if ($mb{"poster"} ne "$user ($userdb{username})" &&
- !&WFUserInGroup($user,"webmasters")) {
- return "Permission denied: You are not the poster of this message.";
- }
-
- if (unlink("ABSWFSPOOL/$in{forum}/$in{subject}/$in{message}") != 1) {
- return "Unable to cancel the message";
- }
-
- # if there are no more messages on the subject, cancel
- # the subject as well.
- rmdir("ABSWFSPOOL/$in{forum}/$in{subject}");
-
- print "<hr><h3>Message cancelled.</h3><hr>";
- return "";
- }
-
- 1;
-